package com.fivetiger.controller;

import com.fivetiger.entity.Master;
import com.fivetiger.entity.PetMessage;
import com.fivetiger.service.inte.MasterService;
import com.fivetiger.service.inte.PetMessageService;
import com.fivetiger.vo.PageBean;
import com.fivetiger.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@Controller
@RequestMapping("/api/petmessage/")
public class PetMessageController {
    @Autowired
    private PetMessageService petMessageService;


    //新增管理员
    @RequestMapping("save.do")
    @ResponseBody
    public R save(PetMessage petMessage){

        return petMessageService.save(petMessage);
    }
    @RequestMapping("all.do")
    @ResponseBody
    public PageBean all(){
        return petMessageService.queryPage();
    }

    @PostMapping("uploadexcel.do")
    public R upload(MultipartFile file){
        return petMessageService.saveBatch(file);
    }

    @RequestMapping("update.do")
    @ResponseBody
    public R update(PetMessage petMessage){
        return petMessageService.change(petMessage);
    }
}
